package com.logic.landseaserver.ws.dto;

import java.sql.Timestamp;
import java.util.Date;

public class RoomTypeDTO {
    private Integer id;

    private Integer prjId;
    
    private String prjName;

    private String typeCode;
    
    private String typeName;

	private Double price;

    private String detailImages;

    private String facility;

    private Date createdDtm;

    private Integer createdBy;

    private Date lastModifiedDtm;

    private Integer lastModifiedBy;

    private Integer version;

    private Boolean deleted;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
    
    public String getPrjName() {
		return prjName;
	}

	public void setPrjName(String prjName) {
		this.prjName = prjName;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}
    public Integer getPrjId() {
        return prjId;
    }

    public void setPrjId(Integer prjId) {
        this.prjId = prjId;
    }

    public String getTypeCode() {
        return typeCode;
    }

    public void setTypeCode(String typeCode) {
        this.typeCode = typeCode == null ? null : typeCode.trim();
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public String getDetailImages() {
        return detailImages;
    }

    public void setDetailImages(String detailImages) {
        this.detailImages = detailImages == null ? null : detailImages.trim();
    }

    public String getFacility() {
        return facility;
    }

    public void setFacility(String facility) {
        this.facility = facility == null ? null : facility.trim();
    }

    public Date getCreatedDtm() {
        return createdDtm;
    }

    public void setCreatedDtm(Date createdDtm) {
        this.createdDtm = createdDtm;
    }

    public Integer getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(Integer createdBy) {
        this.createdBy = createdBy;
    }

    public Date getLastModifiedDtm() {
        return lastModifiedDtm;
    }

    public void setLastModifiedDtm(Date lastModifiedDtm) {
        this.lastModifiedDtm = lastModifiedDtm;
    }

    public Integer getLastModifiedBy() {
        return lastModifiedBy;
    }

    public void setLastModifiedBy(Integer lastModifiedBy) {
        this.lastModifiedBy = lastModifiedBy;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }
    
    public void updateCommonInfo(Integer userId) {

        Timestamp now = new Timestamp(new Date().getTime());
        if (this.getId() == null || this.getId() == 0) { // New PoJo
          this.setVersion(0);
          if (this.getCreatedDtm() == null) {
            this.setCreatedDtm(now);
          }
          if (this.getCreatedBy() == null || this.getCreatedBy().equals(0)) {
            this.setCreatedBy(userId == null ? 0 : userId);
          }
          this.setLastModifiedDtm(now);
          this.setLastModifiedBy(userId == null ? 0 : userId);
          this.setDeleted(false);

        } else { // Update this
          this.setVersion(this.getVersion() == null ? 1 : this.getVersion() + 1);
          this.setLastModifiedDtm(now);
          if (userId.equals(-1)) {
          } else {
            this.setLastModifiedBy(userId == null ? 0 : userId);
          }
        }
      }
    
    
}